home *** CD-ROM | disk | FTP | other *** search
/ mail.altrad.com / 2015.02.mail.altrad.com.tar / mail.altrad.com / TEST / office german / PROPLUS.WW / PROPLSWW.CAB / IPEDITOR.DLL / XSL / 113 < prev    next >
Extensible Markup Language  |  2006-10-27  |  9KB  |  1 lines

  1. <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" > <xsl:output method="text" /> <xsl:variable name="simpleTypes" select="document('')/xsl:stylesheet/xsl:template[@name='simpleTypes']/*"/> <xsl:variable name="lengthTypes" select="document('')/xsl:stylesheet/xsl:template[@name='lengthTypes']/*"/> <xsl:template match="xml/s:Schema/s:ElementType"> <pre/> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://schemas.microsoft.com/office/infopath/2003/ado/queryFields" elementFormDefault="unqualified" attributeFormDefault="unqualified" ><xsl:text/> <xsl:for-each select="//s:ElementType"> <xsd:element name="<xsl:value-of select="@name"/>"><xsl:text/> <xsd:complexType><xsl:text/> <xsl:apply-templates select="s:AttributeType" mode="queryparam"/> </xsd:complexType> </xsd:element><xsl:text/> </xsl:for-each> <xsl:call-template name="BuildTypes"/> </xsd:schema> </xsl:template> <xsl:template match="s:AttributeType" mode="queryparam"> <xsl:variable name="datatype"> <xsl:choose> <xsl:when test="s:datatype/@dt:type = 'i8' and s:datatype/@rs:dbtype = 'currency'">number</xsl:when> <xsl:otherwise><xsl:value-of select="s:datatype/@dt:type" /></xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:choose> <xsl:when test="$datatype = 'bin.hex' or $datatype = 'bin.base64'" > </xsl:when> <xsl:when test="s:datatype/@rs:long" > </xsl:when> <xsl:when test="$datatype = 'Boolean'"> <xsd:attribute name="<xsl:value-of select="@name"/>" type="q:optional_Boolean" default=""/><xsl:text/> </xsl:when> <xsl:when test="$simpleTypes[@xdr = $datatype]"> <xsd:attribute name="<xsl:value-of select="@name"/>" type="q:optional_<xsl:value-of select="$simpleTypes[@xdr = $datatype]/@name"/>"/><xsl:text/> </xsl:when> <xsl:when test="s:datatype[(@dt:minLength and @dt:minLength != '0') or @dt:type = 'uuid']"> <xsd:attribute name="<xsl:value-of select="@name"/>"> <xsd:simpleType> <xsd:union> <xsd:simpleType> <xsd:restriction base="<xsl:apply-templates select="s:datatype/@dt:type" mode="getLengthType"/>"><xsl:text/> <xsl:choose> <xsl:when test="s:datatype[@dt:type='uuid']"> <xsd:pattern value="<xsl:apply-templates select="s:datatype" mode="uuidPattern"/>"/><xsl:text/> </xsl:when> <xsl:when test="s:datatype/@dt:minLength"> <xsd:minLength value="<xsl:value-of select="s:datatype/@dt:minLength"/>"/><xsl:text/> </xsl:when> </xsl:choose> <xsl:if test="s:datatype/@dt:maxLength and s:datatype/@dt:type != 'uuid'"> <xsd:maxLength value="<xsl:value-of select="s:datatype/@dt:maxLength"/>"/><xsl:text/> </xsl:if> </xsd:restriction> </xsd:simpleType> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:maxLength value="0"/> </xsd:restriction> </xsd:simpleType> </xsd:union> </xsd:simpleType> </xsd:attribute><xsl:text/> </xsl:when> <xsl:when test="s:datatype/@dt:maxLength"> <xsd:attribute name="<xsl:value-of select="@name"/>"> <xsd:simpleType> <xsd:restriction base="<xsl:apply-templates select="s:datatype/@dt:type" mode="getLengthType"/>"> <xsd:maxLength value="<xsl:value-of select="s:datatype/@dt:maxLength"/>"/> </xsd:restriction> </xsd:simpleType> </xsd:attribute><xsl:text/> </xsl:when> <xsl:otherwise> <xsd:attribute name="<xsl:value-of select="@name"/>" type="<xsl:apply-templates select="s:datatype/@dt:type" mode="getLengthType"/>"/> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="s:datatype" mode="uuidPattern"> <xsl:variable name="min"> <xsl:choose> <xsl:when test="@dt:minLength"><xsl:value-of select="@dt:minLength - 1"/></xsl:when> <xsl:otherwise>0</xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="max"> <xsl:if test="@dt:maxLength"><xsl:value-of select="@dt:maxLength - 1"/></xsl:if> </xsl:variable> <xsl:text/>\{[0-9A-F]{8,8}\-[0-9A-F]{4,4}\-[0-9A-F]{4,4}\-[0-9A-F]{4,4}\-[0-9A-F]{12,12}\}<xsl:text/> </xsl:template> <xsl:template name="BuildTypes"> <xsl:variable name="dtOrigional" select="//s:datatype[not(@dt:type = preceding::*/@dt:type)]"/> <xsl:variable name="datatype"> <xsl:choose> <xsl:when test="//s:datatype[@dt:type = 'i8' and @rs:dbtype = 'currency']">number</xsl:when> <xsl:otherwise>bogusValue</xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="types" select="$simpleTypes[(@xdr = $dtOrigional/@dt:type or @xdr = $datatype) and not(@xsd = preceding::*[@xdr = $dtOrigional/@dt:type]/@xsd)]"/> <xsd:simpleType name="optional"> <xsd:restriction base="xsd:string"> <xsd:maxLength value="0"/> </xsd:restriction> </xsd:simpleType><xsl:text/> <xsl:for-each select="$types[not(@xsd='string')]"> <xsl:choose> <xsl:when test="@name='Boolean'"> <xsd:simpleType name="optional_Boolean"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="True"/> <xsd:enumeration value="False"/> <xsd:enumeration value=""/> </xsd:restriction><xsl:text/> </xsd:simpleType><xsl:text/> </xsl:when> <xsl:otherwise> <xsd:simpleType name="optional_<xsl:value-of select="@name"/>"><xsl:text/> <xsl:choose> <xsl:when test="@union"> <xsd:union memberTypes="<xsl:value-of select="@union"/> q:optional"/><xsl:text/> </xsl:when> <xsl:when test=".=''"> <xsd:union memberTypes="<xsl:value-of select="@xsd"/> q:optional"/><xsl:text/> </xsl:when> <xsl:otherwise> <xsd:union memberTypes="q:optional"> <xsd:simpleType> <xsl:value-of select="."/> </xsd:simpleType> </xsd:union> </xsl:otherwise> </xsl:choose> </xsd:simpleType><xsl:text/> </xsl:otherwise> </xsl:choose> </xsl:for-each> </xsl:template> <xsl:template name="simpleTypes"> <datatype xdr="bin.base64" xsd="xsd:base64Binary" UsePrecision="no" name="base64Binary"/> <datatype xdr="bin.hex" xsd="xsd:hexBinary" UsePrecision="no" name="hexBinary"/> <datatype xdr="char" xsd="q:char" UsePrecision="no" name="char"> <xsd:restriction base="unsignedShort"/><xsl:text/> </datatype> <datatype xdr="date" xsd="xsd:date" UsePrecision="no" name="date"/> <datatype xdr="dateTime" xsd="q:dateTime.notz" UsePrecision="no" name="dateTime.notz" union="xsd:dateTime xsd:date" /> <datatype xdr="dateTime.tz" xsd="q:dateTime.tz" UsePrecision="no" name="dateTime.tz" union="xsd:dateTime xsd:date" /> <datatype xdr="time" xsd="q:time.notz" UsePrecision="no" name="time.notz"/> <datatype xdr="time.tz" xsd="xsd:time" UsePrecision="no" name="time"/> <datatype xdr="entities" xsd="xsd:ENTITIES" UsePrecision="no" name="ENTITIES"/> <datatype xdr="entity" xsd="xsd:ENTITY" UsePrecision="no" name="ENTITY"/> <datatype xdr="fixed.14.4" xsd="xsd:decimal" UsePrecision="yes" name="decimal"/> <datatype xdr="boolean" xsd="q:Boolean" UsePrecision="no" name="Boolean"> <xsd:restriction base="xsd:string"> <xsd:enumeration value="True"/> <xsd:enumeration value="False"/> </xsd:restriction><xsl:text/> </datatype> <datatype xdr="int" xsd="xsd:int" UsePrecision="yes" name="int"/> <datatype xdr="i1" xsd="xsd:byte" UsePrecision="yes" name="byte"/> <datatype xdr="i2" xsd="xsd:short" UsePrecision="yes" name="short"/> <datatype xdr="i4" xsd="xsd:int" UsePrecision="yes" name="int"/> <datatype xdr="i8" xsd="xsd:long" UsePrecision="yes" name="long"/> <datatype xdr="ui1" xsd="xsd:unsignedByte" UsePrecision="yes" name="unsignedByte"/> <datatype xdr="ui2" xsd="xsd:unsignedShort" UsePrecision="yes" name="unsignedShort"/> <datatype xdr="ui4" xsd="xsd:unsignedInt" UsePrecision="yes" name="unsignedInt"/> <datatype xdr="ui8" xsd="xsd:unsignedLong" UsePrecision="yes" name="unsignedLong"/> <datatype xdr="r4" xsd="xsd:float" UsePrecision="no" name="float"/> <datatype xdr="r8" xsd="xsd:double" UsePrecision="no" name="double"/> <datatype xdr="float" xsd="xsd:double" UsePrecision="no" name="double"/> <datatype xdr="uri" xsd="xsd:anyURI" UsePrecision="no" name="anyURI"/> <datatype xdr="id" xsd="xsd:ID" UsePrecision="no" name="ID"/> <datatype xdr="idref" xsd="xsd:IDREF" UsePrecision="no" name="IDREF"/> <datatype xdr="idrefs" xsd="xsd:IDREFS" UsePrecision="no" name="IDREFS"/> <datatype xdr="nmtoken" xsd="xsd:NMTOKEN" UsePrecision="no" name="NMTOKEN"/> <datatype xdr="nmtokens" xsd="xsd:NMTOKENS" UsePrecision="no" name="NMTOKENS"/> <datatype xdr="notation" xsd="xsd:NOTATION" UsePrecision="no" name="NOTATIONS"/> <datatype xdr="number" xsd="xsd:decimal" UsePrecision="yes" name="decimal"/> </xsl:template> <xsl:template match="@dt:type" mode="getLengthType"> <xsl:choose> <xsl:when test="$lengthTypes[@xdr = current()]"> <xsl:value-of select="$lengthTypes[@xdr = current()]/@xsd"/> </xsl:when> <xsl:otherwise>xsd:string</xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template name="lengthTypes"> <datatype xdr="string" xsd="xsd:string" name="string"/> <datatype xdr="uuid" xsd="xsd:string" name="string"/> </xsl:template> </xsl:stylesheet>